package com.wjj.sixinone.common.util;

import com.wjj.sixinone.common.enums.TPServiceEnum;
import com.wjj.sixinone.common.pojo.log.TPServerLogs;

import java.time.LocalDateTime;

public class TPServerBeanUtil {
    public static TPServerLogs buildBean(Exception e){
        TPServerLogs tpServerLogs = new TPServerLogs();
        tpServerLogs.setType(TPServiceEnum.SERVER_MINIO.getValue());
        tpServerLogs.setErrorMessage(e.getMessage());
        tpServerLogs.setCreateTime(LocalDateTime.now());

        tpServerLogs.setIp(CurrentIpUtils.getUserIP());
        tpServerLogs.setUsername(AuthContextUtil.get().getUsername());
        return tpServerLogs;
    }
}
